module stringlib

contains

integer function strlen(st)
	character, intent(in) :: st*(*)
	integer	i
      
	i = len(st)
	
	do while (st(i:i) .eq. ' ')
		i = i - 1
	enddo

	strlen = i

end function strlen

real function stddev(sig, n)
	integer, intent(in) :: n
	real, intent(in), dimension(0:n) :: sig

	real :: mean
	integer :: i

	do i=1, n
		mean = mean + sig(i)
	enddo

	mean = mean / n

	do i=1, n
		stddev = stddev + ((sig(i) - mean)*(sig(i)-mean))
	enddo

	stddev = stddev / n

	stddev = sqrt(stddev)
	
end function stddev

end module
